Class pyglet.gl.Config

Graphics configuration.

A GLConfig stores the preferences for OpenGL attributes such as the number of auxiliary buffers, size of the colour and depth buffers, double buffering, stenciling, multi- and super-sampling, and so on.

Different platforms support a different set of attributes, so these are set with a string key and a value which is integer or boolean.

See also pyglet.window.Screen.get_best_config and pyglet.window.Screen.get_matching_configs.

Methods

  __init__(self, **kwargs)
Create a template config with the given attributes.
list of tuple (name, value) get_gl_attributes(self)
Return a list of attributes set on this config.
Context create_context(self, share)
Create a GL context that satisfies this configuration.
bool is_complete(self)
Determine if this config is complete and able to create a context.
  __repr__(self)

Instance Variables

int accum_alpha_size
Bits per pixel devoted to the alpha component in the accumulation buffer.
int accum_blue_size
Bits per pixel devoted to the blue component in the accumulation buffer.
int accum_green_size
Bits per pixel devoted to the green component in the accumulation buffer.
int accum_red_size
Bits per pixel devoted to the red component in the accumulation buffer.
int alpha_size
Bits per sample per buffer devoted to the alpha component.
int aux_buffers
The number of auxiliary color buffers.
int blue_size
Bits per sample per buffer devoted to the blue component.
int buffer_size
Total bits per sample per color buffer.
int depth_size
Bits per sample in the depth buffer.
bool double_buffer
Specify the presence of a back-buffer for every color buffer.
int green_size
Bits per sample per buffer devoted to the green component.
int red_size
Bits per sample per buffer devoted to the red component.
int sample_buffers
The number of multisample buffers.
int samples
The number of samples per pixel, or 0 if there are no multisample buffers.
int stencil_size
Bits per sample in the stencil buffer.
bool stereo
Specify the presence of separate left and right buffer sets.

Method Details

__init__

(Constructor) __init__(self, **kwargs)

Create a template config with the given attributes.

Specify attributes as keyword arguments, for example:

template = Config(double_buffer=True)

get_gl_attributes

get_gl_attributes(self)
Return a list of attributes set on this config.
Returns:
list of tuple (name, value): All attributes, with unset attributes having a value of None.

create_context

create_context(self, share)
Create a GL context that satisfies this configuration.
Parameters:
share : Context
If not None, a context with which to share objects with.
Returns:
Context: The new context.

is_complete

is_complete(self)

Determine if this config is complete and able to create a context.

Configs created directly are not complete, they can only serve as templates for retrieving a supported config from the system. For example, pyglet.window.Screen.get_matching_configs returns complete configs.

Returns:
bool: True if the config is complete and can create a context.